package com.fqgj.xjd.user.client.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/3/15
 * Time: 下午9:41
 */
public enum UserQuotaEnum {
    NOT_EVALUATED(0, "not_evaluated", "Quota not yet assessed"), //尚未评估额度
    CREDIT_SCORE_LACK(1, "credit_score_lack", "Credit rating is not enough"), //评分信用不足
    NEED_WAIT_MONTH(2, "need_wait_month", "Please try to query score next month"), //芝麻分和同盾数据不良,提示下个月再来
    PASS(3, "pass", "pass"),
    EXCEPTION(4, "exception", "exception");

    private Integer type;
    private String desc;
    private String name;
    
    UserQuotaEnum(Integer type, String desc, String name) {
        this.type = type;
        this.desc = desc;
        this.name = name;
    }
    
    public Integer getType() {
        return type;
    }

    public UserQuotaEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public UserQuotaEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public String getName() {
        return name;
    }

    public UserQuotaEnum setName(String name) {
        this.name = name;
        return this;
    }

    public static UserQuotaEnum getEnumByType(Integer type) {
        UserQuotaEnum userQuotaEnum = null;
        for (UserQuotaEnum u : UserQuotaEnum.values()) {
            if (u.getType().equals(type)) {
                userQuotaEnum = u;
            }
        }

        return userQuotaEnum;
    }
}
